from datetime import date

from pydantic import BaseModel, PositiveInt


class User(BaseModel):
    id: int
    name: str = 'John Doe'
    date_joined: date
    tastes: dict[str, PositiveInt]


external_data = {
    'id': 123,
    'date_joined': '2030-06-01',
    'tastes': {
        'wine': 9,
        b'cheese': 7,
        'cabbage': '1',
    },
}

user = User(**external_data)
print(user.id, user.name)
